from selenium.webdriver.common.by import By
from common.Utils import ChatroomDriver

#聊天消息详情页测试
class ChatDetails:
    url=""
    driver=""
    def __init__(self):
        self.url="http://127.0.0.1:8080/client.html"
        self.driver=ChatroomDriver.driver
        self.driver.get(self.url)
    #登录状态下
    def DetailsTestByLogin(self):
        self.driver.find_element(By.CSS_SELECTOR, "#session-list > li.selected").click()
        #检查元素
        #聊天对象名称
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.right > div.title")
        #账号名称
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.right > div.message-show > div:nth-child(14) > div > h4")
        #账号聊天内容
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.right > div.message-show > div:nth-child(14) > div > p")
        #聊天对象名称
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.right > div.message-show > div:nth-child(13) > div > h4")
        #聊天对象聊天内容
        self.driver.find_element(By.CSS_SELECTOR,"body > div.client-container > div > div.right > div.message-show > div:nth-child(13) > div > p")
        #屏幕截图
        ChatroomDriver.getScreeShot()
        self.driver.back()

# Details=ChatDetails()
# Details.DetailsTestByLogin()




